{% extends "base.html" %}
{% load slots %}
{% load i18n %}
{% load markup %}
{% load miraflores_tags %}

{% block title %}Search{% endblock %}

{% block extrahead %}
{% if query %}
<link href="{% url miraflores_syndication "rss/search" %}{{ query }}/" type="application/rss+xml" rel="alternate" title="{{ site.name }} RSS Feed -- {% blocktrans with query as query %}Search results for '{{ query }}'{% endblocktrans %}" />
<link href="{% url miraflores_syndication "atom/search" %}{{ query }}/" type="application/atom+xml" rel="alternate" title="{{ site.name }} Atom Feed -- {% blocktrans with query as query %}Search results for '{{ query }}'{% endblocktrans %}" />
{% if user.username %}
  <link href="{% url miraflores_syndication "rss/search" %}{{ query }}/{% feed_user_token user %}/" type="application/rss+xml" rel="alternate" title="{{ site.name }} RSS Feed -- {% blocktrans with query as query and user.username as username %}Search results for '{{ query }}' for {{ username }}{% endblocktrans %}" />
  <link href="{% url miraflores_syndication "atom/search" %}{{ query }}/{% feed_user_token user %}/" type="application/atom+xml" rel="alternate" title="{{ site.name }} Atom Feed -- {% blocktrans with query as query and user.username as username %}Search results for '{{ query }}' for {{ username }}{% endblocktrans %}" />
{% endif %}
{% endif %}
<script type="text/javascript" src="{{ MEDIA_URL }}{{ jquery_url }}"></script>
{% endblock %}

{% block userlinks %}
{% define_slot com.djangoproject.base.userlinks %}
{% endblock %}

{% block nav-global %}
{% define_slot com.djangoproject.base.nav-global %}
{% endblock %}

{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="/">{% trans 'Home' %}</a> &rsaquo;
<a href="{% url miraflores_blog_entry_list %}">{% trans 'Blog' %}</a> &rsaquo;
Search
</div>
{% endblock %}

{% block content_title %}
<h1>Search</h1>
{% endblock %}

{% block content %}
{% block object-tools %}
{% define_slot com.djangoproject.base.object-tools %}
{% endblock %}
<div id="content-main">
<div class="module">
<form action="." method="GET">
<h2>Search the site</h2>
<p>{{ form.q }}<input type="submit" value="Search" /></p>
</form>
</div>
{% if query %}
<hr />
<div class="module">
<h2>Results for <em>{{ query }}</em></h2>
{% for result in paginator.object_list %}
<div class="searchresult">
<h3><a href="{{ result.object.get_absolute_url }}">{{ result.object.title }}</a></h3>
<p class="preview">{{ result.object.body|markdown|truncatewords_html:100|safe }}</p>
<p class="score"><em>Score: {{ result.score }}</em></p>
</div>
{% empty %}
<p>No results found.</em></p>
{% endfor %}
</div>
{% if paginator.count %}
<div class="nextpreviouslinks">
<p>
{% if page.has_previous %}
<a href=".?q={{ query }}&page={{ page.previous_page_number }}">Previous</a> |
{% endif %}
Page {{ page.number }} of {{ paginator.num_pages }}
{% if page.has_next %}
| <a href=".?q={{ query }}&page={{ page.next_page_number }}">Next</a>
{% endif %}
</p>
</div>
{% endif %}
{% endif %}
</div>
{% endblock %}

{% block sidebar %}
{% define_slot com.djangoproject.base.content-related %}
{% endblock %}